package com.niit.servlet;

import com.niit.domain.Carousel;
import com.niit.domain.Notice;
import com.niit.service.ICarouselService;
import com.niit.service.INoticeService;
import com.niit.service.impl.CarouselServiceImpl;
import com.niit.service.impl.NoticeServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(name = "CarouselServlet", value = "/CarouselServlet")
public class CarouselServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                //Carousel轮播图
        ICarouselService ics=new CarouselServiceImpl();
        //carousel的集合list
        List<Carousel> carouselList=ics.carouselService(3);
        //将list存放在session中
        HttpSession carSession=request.getSession();
        carSession.setAttribute("carouselList",carouselList);
        response.sendRedirect("index.jsp");

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
